package com.ruoyi.http.controller;

import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.util.FileUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.data.domain.ParameterSingleT;
import com.ruoyi.data.service.IParameterSingleService;
import com.ruoyi.http.domain.WeChat02000T;
import com.ruoyi.http.service.IWeChatTService;
import com.ruoyi.data.SysParamKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/http/weChat02000")
public class WeChat02000 extends BaseController {

    @Autowired
    private IWeChatTService weChatTService;
    @Autowired
    private IParameterSingleService parameterSingleService;

    @PostMapping("/weChat")
    public AjaxResult http(WeChat02000T weChat02000T) {
        WeChat02000T weChat = new WeChat02000T();
        String date = System.currentTimeMillis()+"";
        if(weChat02000T.getSignphoto()!=null){
            FileUtil.base64ToJpg(RuoYiConfig.getSignPhoto(),weChat02000T.getSignphoto(),date,"svg");
            weChat02000T.setSignPhotoName("签名照片");
            weChat02000T.setSignPhotoHttp(date);
        }
        weChatTService.updateRepairPhoto(weChat02000T);
        return AjaxResult.success(weChat);
    }
}